<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords"
	content="图片SNS社区,视频SNS社区,音乐SNS社区,个性化圈子,个性化视频,问题发现,问题推荐,问题分享,热点视频,精彩图片,最好音乐" />
<meta name="description"
	content="优问网让你的问题会说话,是一个图片、视频、音乐SNS社区，玩转优问，分享问题，一网打尽全网最热图片、最好看视频、最好听音乐。凭借最快速、最全的热点发掘，独有的圈子体验，在这里你能找到同趣好友，分享热门、搞笑、美女等，尽享视觉社交的最大乐趣。">
<title>找回密码-优问网,发现精彩问题 分享无限快乐</title>
<script type="text/javascript" src="js/jquery1.7.2.js"></script>
<script type="text/javascript" src="js/global.js"></script>
<script type="text/javascript" src="/js/formValidator-4.0.1.js"></script>
<script type="text/javascript" src="/js/formValidatorRegex.js"></script>
<link type="text/css" rel="stylesheet" href="/css/home.css" />
<link type="text/css" rel="stylesheet" href="/css/global.css" />
<link rel="stylesheet" type="text/css" href="/css/validator.css" />
<style type="text/css">
.forgetDiv {
	background: #fff;
	border-radius: 6px;
	min-height: 300px;
	padding: 30px 80px;
	margin-top: 20px;
	box-shadow: 0 0 3px #ccc;
}

.forgetDiv h3 {
	border-bottom: solid 1px #ccc;
	line-height: 40px;
	padding-bottom: 20px;
	margin-bottom: 30px;
	font-size: 18px;
}

.bs_span_large {
	color: #90C43C;
	font-size: 14px;
	font-weight: bold;
}

.bs_span_small {
	color: #90C43C;
	font-size: 12px;
}

.bs_input_label {
	float: left;
	padding-right: 10px;
	text-align: right;
	width: 70px;
	line-height: 30px;
	font-size: 14px;
}

.r3 {
	padding: 7px 10px;
	width: 200px;
}

.blue_button {
	display: block;
	margin: 30px 0 0 95px;
	cursor: pointer;
	font-size: 14px;
	height: 36px;
	line-height: 36px;
	text-align: center;
	width: 124px;
	border-radius: 6px;
	background: #FF5D00;
	color: #fff;
	font-size: 14px;
}

.blue_button:hover {
	color: #fff;
}
</style>
</head>
<body>
	<%@include file="../common/noLoginHead2.jsp"%>
	<div id="container">
		<div class="forgetDiv">
			<h3>设置您的新密码</h3>
			<div>
				<span class="bs_span_small">请输入您的新密码</span>
				<br> <br>
			</div>
			<form id="form1">
				<input id = "userId" type="hidden" value = "<s:property value='user.id'/>">
				<input id = "email" type="hidden" value = "<s:property value='user.loginName'/>">
				<div class="forgetForm">
					<label><span class="bs_input_label">新密码:</span> <input
						id="pwd1" class="txt r3" type="password"/></label> 
						<span id="pwd1Tip"></span><br/> <br/>
					<label><span class="bs_input_label">确认密码:</span> <input
						id="pwd2"  class="txt r3" type="password" /></label> 
						<span id="pwd2Tip"></span>
						<a class="blue_button" onclick="resetPwd();">确定</a>
				</div>
			</form>
		</div>
		<div class="footer">杭州优问网络技术有限公司</div>
	</div>
	<script type="text/javascript">
		function initValidator() {
			$.formValidator.initConfig({
				formid : "form1",
				onerror : function(msg) {
					alert(msg)
				}
			});
			$("#pwd1").formValidator({
				tipid : "pwd1Tip",
				onShow : "",
				onFocus : "",
				onCorrect : "　 "
			}).inputValidator({
				min:6,
				max:20,
				empty:{leftEmpty:false,rightEmpty:false,emptyError:"密码两边不能有空格"},
				onError:"密码长度：6-20位",
				onCorrect : "　 "
			}).regexValidator({
				regExp : "^[\@A-Za-z0-9\!\#\$\%\^\&\*\.\~]{6,20}$",
				onError : "密码不合法：6-20个字母、数字或符号"
			});
			$("#pwd2").formValidator({
				tipid : "pwd2Tip",
				onShow : "",
				onFocus : "",
				onCorrect : "　 "
			}).compareValidator({
				desID:"pwd1",
				operateor:"=",
				onError:"2次密码不一致,请确认"
			});
		}
		initValidator();
		//发送密码找回邮件
		function resetPwd(){
			if(!$.formValidator.pageIsValid('1')){
		    	return false;
		    }
			var userId = $.trim($("#userId").val());
			var params = {"user.id":userId,"user.loginName":$("#email").val(),"pwd":$("#pwd1").val()};
			doAsyncAjax("/back.action", params, function(
					ajaxResult) {
				if (ajaxResult.OK) {
					$(".forgetForm").html("密码修改成功，<span id='jumpTo'>5</span>秒后跳转首页 或 <a href='http://www.yoasking.com/toLogin.action'>直接登陆</a>");
					countDown(5,"http://www.yoasking.com");
				}else{
					$(".forgetForm").html(ajaxResult.message);
				}
			});
		}
		function countDown(secs,surl){        
			var jumpTo = document.getElementById('jumpTo');
			jumpTo.innerHTML=secs;  
			if(--secs>0){     
				setTimeout("countDown("+secs+",'"+surl+"')",1000);     
			}else{       
				location.href=surl;     
			}     
		}     
	</script>
</body>
</html>